import request from '@/utils/request'

/**
 * 分页获取
 */
export function getCinemaByPage(params, username, userRole, pageNum, pageSize, token) {
    return request({
        url: '/cinema/list/page',
        method: 'get',
        params: {
            ...params,
            username,
            userRole,
            pageNum,
            pageSize,
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 保存
 */
export function addOrUpdateCinema(data, token) {
    return request({
        url: '/cinema/addOrUpdate',
        method: 'post',
        
        // params: {
        //     ...data
        // },
        data: data,
        headers: {
            'token': token
        }
    })
}

/**
 * 根据登录用户获取影院id
 */
export function getCinemaId(loginUser, token) {
    return request({
        url: '/cinema/getCinemaId/' + loginUser,
        method: 'get',
        headers: {
            'token': token
        }
    })
}

/**
 * 影院详情
 */
export function getCinemaDetail(id, token) {
    return request({
        url: '/cinema/getCinemaDetail/' + id,
        method: 'get',
        headers: {
            'token': token
        }
    })
}

/**
 * 删除影院信息
 */
export function delCinemaById(id, token) {
    return request({
        url: '/cinema/delCinemaById/' + id,
        method: 'post',
        headers: {
            'token': token
        }
    })
}

/**
 * 获取影厅数据
 */
export function getMovieHallListByCinemaId(id, token) {
    console.log(id + "ds")
    return request({
        url: '/movieHall/list/' + id,
        method: 'get',
        headers: {
            'token': token
        }
    })
}

/**
 * 保存
 */
export function addOrUpdateMovieHall(data, token) {
    return request({
        url: '/movieHall/addOrUpdate',
        method: 'post',
        params: {
            ...data
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 影厅详情
 */
export function getMovieHallDetail(id, token) {
    return request({
        url: '/movieHall/getMovieHallDetail/' + id,
        method: 'get',
        headers: {
            'token': token
        }
    })
}

/**
 * 删除影厅信息
 */
export function delMovieHallById(id, token) {
    return request({
        url: '/movieHall/delMovieHallById/' + id,
        method: 'post',
        headers: {
            'token': token
        }
    })
}

/**
 * 更改影厅状态
 */
export function changeMovieHallStatus(id, token) {
    return request({
        url: '/movieHall/changeStatus/' + id,
        method: 'post',
        headers: {
            'token': token
        }
    })
}

/**
 * 更改影厅状态
 */
export function getAdmin(token) {
    return request({
        url: '/cinema/getAdmin',
        method: 'get',
        headers: {
            'token': token
        }
    })
}